VERSION 5.00
Begin VB.Form FrmPopup 
   BackColor       =   &H8000000A&
   BorderStyle     =   0  'None
   Caption         =   "Popup"
   ClientHeight    =   1545
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   2850
   LinkTopic       =   "Form1"
   ScaleHeight     =   1545
   ScaleWidth      =   2850
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox txthid 
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Text            =   "3"
      Top             =   1080
      Visible         =   0   'False
      Width           =   615
   End
   Begin VB.Timer Timer1 
      Interval        =   1
      Left            =   3120
      Top             =   0
   End
   Begin VB.Timer Timer2 
      Enabled         =   0   'False
      Interval        =   1
      Left            =   3120
      Top             =   0
   End
   Begin VB.Timer Timer3 
      Interval        =   1000
      Left            =   3720
      Top             =   480
   End
   Begin VB.Label lbl 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "Welcomer"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   0
      TabIndex        =   2
      Top             =   120
      Width           =   2775
   End
   Begin VB.Label lbl1 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "Welcomer"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   975
      Left            =   0
      MouseIcon       =   "FrmPopup.frx":0000
      TabIndex        =   1
      Top             =   480
      Width           =   2820
   End
   Begin VB.Image Image1 
      Height          =   1545
      Left            =   0
      Stretch         =   -1  'True
      Top             =   0
      Width           =   2835
   End
End
Attribute VB_Name = "FrmPopup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Const SPI_GETWORKAREA = 48
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Dim WindowRect As RECT
Dim taskbar As Long
Const HWND_TOPMOST = -1
Const SWP_NOSIZE = &H1
Dim wFlags As Long, X As Long
Private Declare Sub SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Declare Function BringWindowToTop Lib "user32" (ByVal hWnd As Long) As Long

Private Sub Form_Click()
Timer3.Enabled = True
End Sub
Private Sub Form_Load()
On Error GoTo hell
Image1.Picture = LoadPicture(App.path & "\Resource\popup.blc")
BringWindowToTop Me.hWnd
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 800, 0, 0, SWP_NOSIZE
taskbar = ((Screen.Height / Screen.TwipsPerPixelX) - WindowRect.Bottom) * Screen.TwipsPerPixelX
FrmPopup.Top = Screen.Height
FrmPopup.Left = Screen.Width - FrmPopup.Width
hell:
If Err.Number = 53 Then
On Error Resume Next
End If
End Sub

Private Sub Image1_Click()
Timer2.Enabled = True
End Sub

Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
lbl1.Forecolor = vbWhite
End Sub

Private Sub lbl_Click()
Timer2.Enabled = True
End Sub

Private Sub lbl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
lbl1.Forecolor = vbWhite
End Sub

Private Sub lbl1_Click()
Timer2.Enabled = True
End Sub

Private Sub lbl1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
lbl1.Forecolor = vbBlue
End Sub

Private Sub Timer1_Timer()

SystemParametersInfo SPI_GETWORKAREA, 0, WindowRect, 0
taskbar = ((Screen.Height / Screen.TwipsPerPixelX) - WindowRect.Bottom) * Screen.TwipsPerPixelX
If (FrmPopup.Top + FrmPopup.Height + taskbar) > Screen.Height Then
FrmPopup.Top = FrmPopup.Top - 200
Else
Timer1.Enabled = False
End If
End Sub
Private Sub Timer2_Timer()
SystemParametersInfo SPI_GETWORKAREA, 0, WindowRect, 0
taskbar = ((Screen.Height / Screen.TwipsPerPixelX) - WindowRect.Bottom) * Screen.TwipsPerPixelX
If (FrmPopup.Top + FrmPopup.Height + taskbar) <= (Screen.Height * 1.2) Then
FrmPopup.Top = FrmPopup.Top + 300
Else
Timer2.Enabled = False

Call Unloadform
End If
End Sub
Private Sub Unloadform()
Unload Me
End Sub

Private Sub Timer3_Timer()
txthid.Text = Val(txthid.Text) - 1
If txthid.Text <= 0 Then
Timer2.Enabled = True
End If

End Sub
